<template>
	<w-layout showNavbar :navTitle="page.title" :navTitleColor="publicStyles['--color-t1']" background="url('/static/image/bk.png') no-repeat"
		navBackgroundColor="transparent" :scrollTop="page.scrollTop" :navScrollColor="publicStyles['--color-bk']">
		<template #default>
			<view class="container">
				<up-parse :content="state.content" :tagStyle="state.tagStyle"></up-parse>
			</view>
		</template>
	</w-layout>
</template>

<script setup>
	import {
		ref,
		reactive,
		onMounted,
		computed,
		nextTick
	} from 'vue'
	import {
		storeToRefs
	} from 'pinia'
	import {
		onLoad, onPageScroll
	} from '@dcloudio/uni-app'
	import {
		useAppStore
	} from '@/store/app'
	import {
		useColorStore
	} from '@/store/color'
	import {
		get_parse
	} from '@/utils/request/api';
	import {
		useUserStore
	} from '@/store/user'
	const userStore = useUserStore()
	const appStore = useAppStore()
	const colorStore = useColorStore()
	const {
		publicStyles
	} = storeToRefs(colorStore)
	onLoad(async(options) => {
		if(options.type){
			get_parseApi(options.type)
		}
		if(options.title){
			page.title = options.title
			uni.setNavigationBarTitle({
				title: page.title
			})
		}
	})
	onMounted(() => {
		appStore.loadingHandler(false)
	})
	onPageScroll((e)=>{
		page.scrollTop = e.scrollTop
	})
	const page = reactive({
		scrollTop:0,
		title:''
	})
	
	const popup = reactive({
		showSign:false,
	})
	
	const state = reactive({
		content:'',
		tagStyle:{
			// table: 'border: 1px solid #000000;border-collapse: collapse;width: 100%',
			// th: 'border: 1px solid #000000;display: table-cell;vertical-align: middle !important;text-align: center !important;',
			// td: 'border: 1px solid #000000;display: table-cell;vertical-align: middle !important;text-align: center !important;',
			// // text: 'font-size: 17px;',
			// // p: 'font-size: 17px;margin-bottom: 11px',
			// // span: 'font-size: 17px;'
		}
	})
	
	async function get_parseApi(type){
		const res = await get_parse({
			type
		})
		state.content = res
	}
	
	
</script>

<style lang="scss">
	.container {
		width: 100%;
		min-height: 100%;
		position: relative;
		overflow: hidden;
		box-sizing: border-box;
		padding: 40rpx;
		line-height: 1.8;
	}
	
</style>